home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0154_Re: That annoying Beep in TEdit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-08-30  |  558 b   |  20 lines

  1.  
  2. {
  3. -Does anybody know how I can supress the BEEP in a TEdit component while
  4. -pressing the RETURN key?
  5.  
  6. Trap the <Enter> key in the TEdit's OnKeyPress handler.
  7. Here's the sort of thing I've been using to make the
  8. <Enter> key behave like the <Tab> key in a TEdit...
  9. }
  10.  
  11. procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
  12.   BEGIN
  13.     if (Key = #13) then    {= gotcha! =}
  14.       BEGIN
  15.         Key := #0;         {= kill the beep =}
  16.         PostMessage(Handle, WM_NEXTDLGCTL, 0, 0);   {= move to next tab stop =}
  17.       END;
  18.   END;
  19.  
  20.